<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"

	rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type="text/javascript" src="/js/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="/js/tabcontrol/TabPanel.js"></script>

<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　


　　　
</style>

<script type="text/javascript">
		function addpanel(id,title,html) {
				window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
			}
			
	$(document).ready(
			function() {
				var apply = $("#mid").val()
				if(apply==''){
					document.getElementById("apply").disabled=true;
				}
				$("#sub").click(function(){ 
	    		 var  is= subForm();  
		    		 if(is){
		    		    $("#queryUserForm").attr("action","<%=basePath%>/diaodan/diaodanapplysearch.ct");
		    			$("#queryUserForm").submit();
		    		 }
           		 });
           		 
           		 
           		 
           		$("#apply").click(function() {
           		             var idd="";
							var max = $("input[name=multi_sel]");
							if(max.length>0){
								var rows = $("input[name=multi_sel]:checked");
								if(rows.length>0){
								$("input[name=multi_sel]:checked").each(function(){ 
								if(idd==""){
					            		   idd=$(this).val() ;
					            		}else{
					            		   idd=idd+","+$(this).val() ;
					            		}
								}) 
								
								  $("#queryUserForm").attr("action","<%=basePath%>/diaodan/diaodanapply.ct?idd="+idd);
								  $("#queryUserForm").submit();
								}else{
								  alert("请选择结算记录！");
								}
							}else{
								  $("#queryUserForm").attr("action","<%=basePath%>/diaodan/diaodanapply.ct?idd="+idd);
								  $("#queryUserForm").submit();
							}
				});		 
			});
	 function diaodanapply(termtrace,acountno){
	   
	  	$("#queryUserForm").attr("action","<%=basePath%>/diaodan/diaodanapply.ct?termtrace="+termtrace+"&acountno="+acountno);
	    $("#queryUserForm").submit();
	 }			
function   str2date(str){   
  var   d=null;   
  var   reg=/^(\d{4})(\d{2})(\d{2})$/  ;
  if(arr=str.match(reg))d=new   Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
  return   d;   
  }  
function  subForm(){
     var merNo = $("#merNo").val();
 	 var acountno = $("#acountno").val();
	 
	 var termtrace = $("#termtrace").val();
	 var etsdate = $("#etsdate").val();
	 if(merNo==''){
	   alert("请输入商户号！");
	   return false;
	 }
	 if(acountno==''){
	   alert("请卡号！");
	   return false;
	 }
	  /*
 	 if(etstermId==''){
	   alert("请输入终端号！");
	   return false;
	 }
	
	 if(period==''){
	   alert("请输入批次号！");
	   return false;
	 }
	 if(termtrace==''){
	   alert("请输入终端流水号！");
	   return false;
	 }
	 if(etsdate==''){
	   alert("请输入系统参考号！");
	   return false;
	 }
	 */
		return true;
}	

		


</script>



</head>

<body>

	<div class="subpage">
		<s:form id="queryUserForm" action="/diaodan/diaodanapplysearch.ct" method="post"
			theme="simple">
			<div class="user_title">
				<h2 class="headline-inquires">
					POS收单运营管理平台<br />
					<span class="sub-title"></span>
				</h2>
			</div>
			<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="query_table">

				<tr>
					<td colspan="4" align="center">
						<h2 class="headline-inquires">
							调单申请<br />
							<span class="sub-title"></span>
						</h2>

					</td>
				</tr>


				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>


				<tr>
					<td align="right">商户号：</td>
					<td align="left" colspan="1"><s:textfield id="merNo"
							name="searchCondition.merNo" cssClass="queryWidth" /><font color="red">*</font></td>
					<td align="right" >卡号：</td>
				
						  <td align="left" colspan="1"><s:textfield id="acountno"
							name="searchCondition.accountno" cssClass="queryWidth" /><font color="red">*</font>
						    
					</td>	
				</tr>
			
			
				<tr>			
					
					<td align="right">交易时间：</td>
					<td align="left" colspan="1"><s:textfield id="etsdate"
							name="searchCondition.etsdate"
							onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
							theme="simple" cssClass="queryWidth" /> <font color="red">*</font></td>
					<td align="right" >终端流水号：</td>
						
						  <td align="left" colspan="1"><s:textfield id="termtrace"
							name="searchCondition.termtrace" cssClass="queryWidth" />
					</td>
				
				
				</tr>
				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
				<tr>
						<td colspan="4" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
								<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="4" align="center"><input id="sub" value="查   询" type="button"/>
						&nbsp;&nbsp;&nbsp;&nbsp; <s:reset value="取  消" />&nbsp;&nbsp;&nbsp;&nbsp;
					
				</tr>
				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">

				<tr>
					<td colspan="4" align="center">
						<h2 class="headline-inquires">交易信息</h2>
					</td>
				</tr>
				
			</table>
			<table id="tableList" width="100%" class="table">
				<thead>
					<tr>  	
					    <th>所属机构</th>
						<th>所属代理商</th>
						<th>商户号</th>
						<th>商户名</th>
						<th>交易日期</th>
						<th>交易时间</th>
						<th>终端号</th>
						<th>流水号</th>
						<th>系统参考号</th>
						<th>批次号</th>
						<th>交易金额（元）</th>
						<th>交易类型</th>
						<th>交易状态</th>
						<th>扣率类型</th>
						<th>扣点</th>
						<th>封顶值</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				  <s:iterator value="#request.diaodanlist" status="stat" id="sett">
					<tr class="<s:if test="#stat.index%2==0">tr_0</s:if>" >
							<td>
							<s:hidden name="mid" id="mid" value="%{#sett.merchantno}"/>
							 <s:property value="#sett.orgcode"/> </td>
							<td> <s:property value="#sett.agentid"/> </td>
							<td> <s:property value="#sett.merchantno"/> </td>
							<td> <s:property value="#sett.merchantname"/> </td>
							<td> <s:property value="#sett.transdate"/> </td>
							<td> <s:property value="#sett.transtime"/> </td>
							<td> <s:property value="#sett.termid"/> </td>
							<td> <s:property value="#sett.termtrace"/> </td>
							<td> <s:property value="#sett.etstrace"/> </td>
							<td> <s:property value="#sett.period"/> </td>
							<td> 
							<page:amount amount="${sett.transamt/100}"/>
							 </td>
							<td> <s:property value="#sett.etstrancode"/> </td>
							<td> <s:property value="#sett.respcode"/> </td>
							<td> 
							 <s:if test="#sett.commmode==\"1\"">
					                          点数
					        </s:if>
					        <s:else>封顶</s:else>
							 </td>
					       	<td> <s:property value="#sett.commrate"/> </td>
							<td> <s:property value="#sett.commamt"/> </td>
							<td>
							<s:if test="#sett.reversal==\"0\"">
					                          申请调单
					        </s:if>
					        <s:else>
					        	<s:a href="javascript:addpanel('','申请调单','/fmposm/diaodan/diaodanapply.ct?termtrace=%{#sett.termtrace}&acountno=%{#sett.accontno}')">申请调单</s:a>
					        </s:else>
							
							<!-- 
							<input id="apply"  value="申请调单" onclick="diaodanapply('<s:property value='#sett.termtrace'/>','<s:property value='#sett.accontno'/>');" type="button"/> </td>
					 -->
					 </tr>
					</s:iterator>
				</tbody>
				</table>
				
		</s:form>
	</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
